<?php

class CommentModel extends AbstractModel
{

    const TARGET_TYPE_REVIEW = 'review';
    const TARGET_TYPE_COMPANY = 'company';
    const TARGET_TYPE_WISHES = 'wishes';
    const TARGET_TYPE_OPINION = 'opinion';

    protected $_user;
    protected $_children;
    protected $_target;

    public function setTarget($target)
    {
	$this->_target = $target;
    }

    public function getTarget()
    {
	return $this->_target;
    }

    public function setChildren($children)
    {
	$this->_children = $children;
    }

    public function getChildren()
    {
	return $this->_children;
    }

    public function setUser(UserModel $user)
    {
	$this->_user = $user;
    }

    public function getUser()
    {
	if ($this->_user === null) {
	    if ($this->getDbData('user_id')) {
		$userModel = FactoryService::get('user')->get($this->getDbData('user_id'));
		if ($userModel) {
		    $this->setUser($userModel);
		}
	    }
	}
	return $this->_user;
    }

    protected function _init()
    {
	
    }

}